/* Markdown查看器样式 */
.markdown-viewer {
  max-width: 100%;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
}

/* 头部元数据 */
.markdown-header {
  padding: 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 8px 8px 0 0;
}

.markdown-title {
  font-size: 2.5em;
  font-weight: 700;
  margin: 0 0 16px 0;
  line-height: 1.2;
}

.markdown-description {
  font-size: 1.2em;
  margin: 0 0 20px 0;
  opacity: 0.9;
  line-height: 1.5;
}

.markdown-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  font-size: 14px;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.meta-label {
  font-weight: 600;
  opacity: 0.8;
}

.meta-value {
  opacity: 0.9;
}

.tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tag {
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

/* 工具栏 */
.viewer-toolbar {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  background: #f8f9fa;
  border-bottom: 1px solid #e1e5e9;
  gap: 8px;
}

.toolbar-btn {
  padding: 6px 12px;
  border: 1px solid #d1d5da;
  background: #fff;
  color: #24292e;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s;
}

.toolbar-btn:hover {
  background: #f6f8fa;
  border-color: #c1c8cd;
}

/* 内容区域 */
.viewer-content {
  display: flex;
  position: relative;
}

/* 目录面板 */
.toc-panel {
  width: 280px;
  background: #f8f9fa;
  border-right: 1px solid #e1e5e9;
  padding: 20px;
  overflow-y: auto;
  max-height: 600px;
}

.toc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e1e5e9;
}

.toc-header h3 {
  margin: 0;
  font-size: 16px;
  color: #24292e;
}

.toc-close {
  background: none;
  border: none;
  font-size: 18px;
  color: #6a737d;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s;
}

.toc-close:hover {
  background: #e1e5e9;
  color: #24292e;
}

.toc-content {
  font-size: 14px;
}

.toc-item {
  margin-bottom: 4px;
}

.toc-item.level-0 {
  margin-left: 0;
}

.toc-item.level-1 {
  margin-left: 16px;
}

.toc-item.level-2 {
  margin-left: 32px;
}

.toc-item.level-3 {
  margin-left: 48px;
}

.toc-item.level-4 {
  margin-left: 64px;
}

.toc-item.level-5 {
  margin-left: 80px;
}

.toc-link {
  color: #0366d6;
  text-decoration: none;
  display: block;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s;
  line-height: 1.4;
}

.toc-link:hover {
  background: #e1e5e9;
  color: #0056b3;
}

.toc-children {
  margin-top: 4px;
}

/* 主要内容 */
.markdown-main {
  flex: 1;
  overflow-y: auto;
}

.viewer-markdown {
  max-height: none;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .markdown-header {
    padding: 16px;
  }
  
  .markdown-title {
    font-size: 2em;
  }
  
  .markdown-description {
    font-size: 1.1em;
  }
  
  .markdown-meta {
    flex-direction: column;
    gap: 12px;
  }
  
  .viewer-toolbar {
    padding: 8px 16px;
  }
  
  .toc-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    z-index: 1000;
    background: #fff;
    border: none;
    border-radius: 0;
  }
  
  .toc-header {
    background: #f8f9fa;
    padding: 16px;
    margin: -20px -20px 16px -20px;
    border-bottom: 1px solid #e1e5e9;
  }
}

/* 暗色主题支持 */
@media (prefers-color-scheme: dark) {
  .markdown-viewer {
    background: #1a1a1a;
  }
  
  .markdown-header {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
  }
  
  .viewer-toolbar {
    background: #2d2d2d;
    border-bottom-color: #404040;
  }
  
  .toolbar-btn {
    background: #2d2d2d;
    color: #e0e0e0;
    border-color: #404040;
  }
  
  .toolbar-btn:hover {
    background: #404040;
    border-color: #555;
  }
  
  .toc-panel {
    background: #2d2d2d;
    border-right-color: #404040;
  }
  
  .toc-header {
    border-bottom-color: #404040;
  }
  
  .toc-header h3 {
    color: #e0e0e0;
  }
  
  .toc-close {
    color: #888;
  }
  
  .toc-close:hover {
    background: #404040;
    color: #e0e0e0;
  }
  
  .toc-link {
    color: #4dabf7;
  }
  
  .toc-link:hover {
    background: #404040;
    color: #339af0;
  }
  
  .markdown-main {
    background: #1a1a1a;
  }
}

/* 动画效果 */
.toc-panel {
  animation: slideInLeft 0.3s ease;
}

@keyframes slideInLeft {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toolbar-btn {
  transition: all 0.15s ease;
}

.toc-link {
  transition: all 0.15s ease;
}
